package hxy.bytecode.file;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;

public class ReadConfig {
    public static void main(String[] args) {
        String filePath = "/home/eric/文档/config.conf";
        File file = new File(filePath);
        HashMap<String,String> hashMap = new HashMap<>(1<<5);
        try {
            BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件
            String s = null;
            while ((s = br.readLine()) != null) {//使用readLine方法，一次读一行
                String[] split = s.split("=");
                hashMap.put(split[0],split[1]);
            }
            br.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

        // 下面是修改某个键的值
        String updateKey = "java";

        String oldValue = hashMap.put(updateKey,"新的值");



    }
}
